<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #canvas {
            border: 1px solid;
        }
    </style>
</head>

<body>
    <canvas width="400" height="400" id="canvas">
        请升级你的服务器
    </canvas>
    <script>
        var canvas = document.querySelector('#canvas')
        var context = canvas.getContext('2d');
       
        context.fillRect(50,50,150,150);
        context.globalCompositeOperation = 'destination-out' // 会覆盖前面的图形 
        context.fillStyle='#f00';
        // context.globalCompositeOperation='source-over | copy | destination-in | destination-out | destination-over | lighter | source-atop | source-in | source-out | xor';
        
        context.arc(200, 200, 80, Math.PI / 180 * 0, Math.PI / 180 * 360, false);
        context.fill();
      
      
        





    </script>
</body>

</html>